function result = trajectoryPred(XTRAIN,ytrain,XTEST)


load groundTruth.dat;
load lecturer.dat;
load saliency.dat;
load boards.dat;
load panning.mat;
addpath(genpath('./LIBSVM/'))

% Find matrix seperator column first
separating_column = 0;
for i = 1:size(XTRAIN,2)
    if (XTRAIN(:,i) == -1*ones(1,size(XTRAIN,1))')
        separating_column = i;
        break;
    end
end

separating_column


% Start by training the SVM for panning

% Panning ground truth
l = panning_indicator;

tic
cmd = ['-t 2 -c ', num2str(2^log2c), ' -g ', num2str(2^log2g)];
model =  svmtrain(l(training_seq), XTRAIN(:,1:separating_column-1) ,cmd);
                
[predicted_panning_label, accuracy, decision_values] = svmpredict(l(testing_seq), XTEST(:,1:separating_column-1), model);
[precision, recall, accuracy] = computePrecisionRecall(predicted_panning_label, l(testing_seq));

toc
                
                
b = glmfit(XTRAIN, ytrain,'normal');

%b = regress(ytrain,XTRAIN);

result = [ones(size(XTEST,1),1) XTEST]*b;

% size(ytrain)
% size(XTRAIN)
% size(XTEST)
% size(result)
% size(b)
%diff = ytrain' - result;
%tMSE = mean(sum(diff.*diff));
%  result = XTEST*regress(ytrain,XTRAIN);
% disp('test')
% 
% figure
% plot(t,result,tytrain,'LineWidth',1.8,'MarkerSize',8);
% legend('Estimiated Traj','Actual');
% title(['Errors: ' num2str(tMSE)]);

end